package top.ichengyi.springai.starter.autoconfigure;

import top.ichengyi.springai.starter.factory.AiModelFactory;
import top.ichengyi.springai.starter.properties.MultiModelProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 多模型自动配置类
 */
@Configuration
@EnableConfigurationProperties(MultiModelProperties.class)
@ConditionalOnProperty(prefix = "spring.ai.models", name = "enabled", havingValue = "true", matchIfMissing = true)
public class MultiModelAutoConfiguration {
    
    @Bean
    @ConditionalOnMissingBean
    public AiModelFactory aiModelFactory(MultiModelProperties multiModelProperties) {
        return new AiModelFactory(multiModelProperties);
    }
}